package com.hyzx.qbasic.admin.common.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Created by 黄江华 on 2017/10/13
 */

@Component
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private LocalStorageConfig localStorageConfig;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/upload/**")
                .addResourceLocations("file://".concat(localStorageConfig.getFileUploadLocation()).concat("/"));
    }
}

